//
//  ConcernAndFunsViewController.m
//  ioschishan
//
//  Created by 马田成 on 2017/7/18.
//  Copyright © 2017年 qianyi. All rights reserved.
//

#import "ConcernAndFunsViewController.h"
#import "SDCycleScrollView.h"
#import "ConcernAndFunsOtherVC.h"
#import "ZJScrollPageView.h"
@interface ConcernAndFunsViewController ()<SDCycleScrollViewDelegate,ZJScrollPageViewDelegate>

@property (weak, nonatomic) ZJContentView *contentView;
@property (weak, nonatomic) ZJScrollSegmentView *segmentView;
@property(strong, nonatomic)NSArray<UIViewController<ZJScrollPageViewChildVcDelegate> *> *childVcs;


@property(strong, nonatomic)NSMutableArray *titles;
@property (nonatomic, strong) UILabel *label;


@end

@implementation ConcernAndFunsViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    [self setTitle:@"关注"];
    [self creationTitle];
    
    // Do any additional setup after loading the view.
}
- (void)creationTitle{
    
    
    self.automaticallyAdjustsScrollViewInsets = NO;
    ZJSegmentStyle *style = [[ZJSegmentStyle alloc] init];
    //显示滚动条
    style.showLine = YES;
    // 颜色渐变
    style.gradualChangeTitleColor = YES;
    style.scrollTitle = YES;
    style.autoAdjustTitlesWidth = YES;
    style.adjustCoverOrLineWidth = YES;
    style.selectedTitleColor = [UIColor colorWithRed:6 / 255.0f green:6 / 255.0f blue:6 / 255.0f alpha:1];
    style.scrollLineColor = [UIColor colorWithRed:93 / 255.0f green:202 / 255.0f blue:53 / 255.0f alpha:1];
    style.segmentHeight = 39;
    self.titles = @[@"关注",
                    @"粉丝",
                    ].mutableCopy;
    
    // 初始化
    ZJScrollPageView *scrollPageView = [[ZJScrollPageView alloc] initWithFrame:CGRectMake(0, 0, DEF_SCREEN_WIDTH, DEF_SCREEN_HEIGHT - 64.0) segmentStyle:style titles:self.titles parentViewController:self delegate:self];
    
    [scrollPageView setSelectedIndex:self.indexID animated:YES];
    scrollPageView.contentView.scrollView.scrollEnabled = YES;
    [self.view addSubview:scrollPageView];
    
    UILabel *labelOfOne = [[UILabel alloc] init];
    [self.view addSubview:labelOfOne];
    labelOfOne.frame = CGRectMake(0, 0, DEF_SCREEN_WIDTH, 1);
    labelOfOne.backgroundColor = getThreadColor();
    

}

#pragma mark ----------------ZJScrollPageViewDelegate---------------------
- (NSInteger)numberOfChildViewControllers {
    
    return self.titles.count;
    
}



- (UIViewController<ZJScrollPageViewChildVcDelegate> *)childViewController:(UIViewController<ZJScrollPageViewChildVcDelegate> *)reuseViewController forIndex:(NSInteger)index {
    
    ConcernAndFunsOtherVC <ZJScrollPageViewChildVcDelegate> *childVc = (ConcernAndFunsOtherVC *)reuseViewController;
    
    if (!childVc) {
        
        childVc = [[ConcernAndFunsOtherVC alloc] init];
        
        NSLog(@"AAAAAAAAAAAAAAA%@", childVc.orderStatus);
        
        
    }
    
    return childVc;
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
